#!/bin/sh
module="scull04"
device="scull"
mode="644"

/sbin/insmod ./$module.ko $* || exit 1

rm -f /dev/${device}[0-3]

major=$(awk "\$2= =\"$module\" {print \$1}" /proc/devices)

mknode /dev/${device}0 c $major 0
mknode /dev/${device}0 c $major 1
mknode /dev/${device}0 c $major 2
mknode /dev/${device}0 c $major 3

group="staff"
grep -q '^staff:' /etc/group || group="wheel"

chgrp $group /dev/${device}[0-3]
chmod $mode /dev/${device}[0-3]
#cat /proc/devices |grep scull | awk '{print }'
